<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="vue.js"></script>
</head>
<body>
<div id="app">
     <div @click="handleClick">
       {{message}}
     </div>
     <item></item>
</div>
<script>
    Vue.component('item',{
        template:'<div>创建一个全局组件<span>{{message}}</span></div>'
    });
    var vm=new Vue({
      el:"#app",
      data:{
          message:'hello world'
      },
      methods:{
          handleClick:function(){
              alert("开始会意");
              vm.$data.message='开始会意';
          }
      }
    })
</script>
</body>
</html>
